Skip to content

Conversation

@epeicher
Copy link
Contributor

@epeicher epeicher commented Nov 6, 2025

Related issues

Designs here with multiple options RToz6tIuQ7nlZrikBte4GU-fi-10114_136499 The implemented option is F in the designs with the button on the left as suggested here

These changes are based on the changes from PR #2002

Before After with non-connected site After with a site already connected
CleanShot 2025-11-07 at 18 36 54@2x CleanShot 2025-11-07 at 19 00 30@2x CleanShot 2025-11-07 at 18 36 21@2x

Video with demo of changes

CleanShot.2025-11-07.at.18.37.39.mp4

Proposed Changes

  • Added a "Publish site" on the header that displays when a site has no connected WordPress.com sites
  • Clicking the button navigates to the Sync tab and opens the push modal

Testing Instructions

  1. Start Studio and create or open a local WordPress site
  2. Ensure the site has no connected WordPress.com sites (disconnect any if needed)
  3. Verify a button with Publish site appears on the header
  4. Click the "Publish site" button
  5. Verify it navigates to the Sync tab and opens the push modal
  6. Connect a WordPress.com site and return to the Overview tab
  7. Verify the banner no longer appears when a site is connected

Regression testing

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@epeicher epeicher self-assigned this Nov 6, 2025
@github-actions
Copy link

github-actions bot commented Nov 6, 2025

📊 Performance Test Results

Comparing 00679e5 vs trunk

site-editor

Metric trunk 00679e5 Diff Change
load 7777.00 ms 11705.00 ms +3928.00 ms 🔴 50.5%

site-startup

Metric trunk 00679e5 Diff Change
siteCreation 19299.00 ms 19255.00 ms -44.00 ms 🟢 -0.2%
siteStartup 5954.00 ms 4982.00 ms -972.00 ms 🟢 -16.3%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change

@epeicher epeicher force-pushed the stu-911-studio-add-launch-your-site-in-the-main-navigation branch from 0c388a1 to 706b4f7 Compare November 6, 2025 13:09
@epeicher epeicher changed the title Studio: Add Publish banner on Overview tab for non-connected sites Add Publish banner on Overview tab for non-connected sites Nov 6, 2025
@epeicher epeicher requested a review from a team November 6, 2025 17:10
@epeicher epeicher marked this pull request as ready for review November 6, 2025 17:11
Copy link
Member

@sejas sejas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for implementing the Option A! ✨
It's great we can test the banner in the app.

I found a small issue. When I run npm start (or click cmd+R) and directly click on Publish site the tab doesn't change and therefore the modal is not present. Once I change to the Sync tab the modal appears successfully and then the Publish button starts working as expected.

publish-site-in-overview.mp4

@katinthehatsite
Copy link
Contributor

I found a small issue. When I run npm start (or click cmd+R) and directly click on Publish site the tab doesn't change and therefore the modal is not present. Once I change to the Sync tab the modal appears successfully and then the Publish button starts working as expected.

I saw this as well in my testing. I also noticed a different variation of this issue:

  • Start the app with npm start
  • Click on the Publish button from Overview and observe that it does nothing
  • Switch to a different site that already has sites connected
  • Observe the modal gets immediately triggered for that site

Once I change to the Sync tab the modal appears successfully and then the Publish button starts working as expected

I noticed that it happens when you switch to any tab e.g. Settings and the modal gets triggered as well.

Copy link
Contributor

@katinthehatsite katinthehatsite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!!

I noticed one alignment issue. I see that in Figma, we have the banner for option B stretched along over the thumbnail like so:

Image

If we decide to go with Option A which the currently implementation seems to be closes to, we can then make sure to drop the banner lower to be consistent with the top of the preview:

Screenshot 2025-11-07 at 10 52 46 AM

vs.the current implementation:

Image

If we decided to do that, we can then ignore my comment regarding the border being more rounded.

@sejas
Copy link
Member

sejas commented Nov 7, 2025

Let's consider adding the Publish site button in the main navigation, so option E or F are winning. p58i-ofU-p2#comment-71383 . I'm not 100% convinced with the design though.

Screenshot 2025-11-07 at 12 55 46

@sejas
Copy link
Member

sejas commented Nov 7, 2025

I think I prefer option F, but being the Publish site on the left, so the start/stop button doesn't change positions.

@wojtekn
Copy link
Contributor

wojtekn commented Nov 7, 2025

I think I prefer option F, but being the Publish site on the left, so the start/stop button doesn't change positions.

Would it make sense to add an icon to the button, too? E.g. globe or cloudUpload?

Base automatically changed from update/connect-sites to trunk November 7, 2025 14:45
@claude
Copy link

claude bot commented Nov 7, 2025

Claude finished @epeicher's task —— View job


Code Review Complete ✅

I've completed a comprehensive code review of PR #2025. Here are my findings:


🔴 Critical Issues

1. Modal Not Appearing on First Click (Bug)

Location: src/components/publish-site-button.tsx:17-20

Root Cause: The tab remounting logic in site-content-tabs.tsx causes the component to remount when switching tabs programmatically. This happens BEFORE the modal state can be rendered, causing it to be lost.

Impact: Users must switch tabs twice before seeing the modal - poor UX.

Solution: I've provided detailed suggestions in the inline comments, including using setTimeout to ensure modal state is committed before tab changes, or checking for active modal state before remounting.

2. Incorrect TypeScript Import

Location: src/components/publish-site-button.tsx:1

Importing from '@wordpress/i18n/build-types' is incorrect - should import from '@wordpress/i18n' directly. This import is also redundant since __ is available via useI18n().


⚠️ Important Issues

3. Missing Test Coverage

The new PublishSiteButton component has no dedicated tests. The existing tests don't verify:

  • Button renders when no sites are connected
  • Button doesn't render when sites are connected
  • Button click navigates to sync tab
  • Button click opens push modal

4. Accessibility Concerns

  • Tooltip provides info on hover, but screen readers need aria-label or aria-describedby
  • Disabled state messaging could be clearer
  • Keyboard navigation order should be verified

5. Layout & Responsiveness

  • Button position in header actions could cause layout issues on smaller windows
  • Start/Stop button position shifts when PublishSiteButton appears/disappears
  • As noted in comments, consider placing button on left side to prevent shifting

✅ Good Practices Observed

  • ✅ Clean early return pattern for conditional rendering
  • ✅ Proper use of Tooltip component for disabled states
  • ✅ Good separation of concerns with dedicated component
  • ✅ Consistent use of i18n for all strings
  • ✅ Proper Redux state management

📊 Performance Impact

The 29.4% regression in site-editor load time is concerning and should be investigated. While this PR only adds a button and doesn't touch site-editor code, the regression could be:

  1. A fluke in the test run (should re-run)
  2. Related to the additional Redux selector calls
  3. Unrelated to this PR (coincidental timing)

Recommendation: Re-run performance tests to confirm if this is a real regression.


🔒 Security Review

✅ No security issues identified:

  • No user input handling
  • No XSS vulnerabilities
  • Proper use of React patterns prevents injection
  • Redux actions properly typed
  • IPC not directly accessed (goes through hooks)

🌍 Cross-Platform Compatibility

Generally good, but consider:

  • RTL language support appears correct (flex layout)
  • Test on both macOS and Windows as per CLAUDE.md guidelines
  • Tooltip interactions should be tested on both platforms
  • Keyboard navigation should work consistently

📝 Recommendations

  1. Fix the modal bug immediately - This is blocking the feature from working correctly
  2. Remove incorrect import on line 1 of publish-site-button.tsx
  3. Add comprehensive tests for the new component
  4. Improve accessibility with proper ARIA labels
  5. Re-evaluate design placement - Consider feedback about moving to main navigation
  6. Investigate performance regression - Re-run tests to confirm
  7. Test cross-platform - Verify on macOS and Windows before merging

💡 Design Feedback

Based on the PR comments, there's ongoing discussion about button placement (Options E/F with button in main navigation). Consider holding this PR until design is finalized to avoid rework.


Overall Assessment: The implementation is clean and follows good patterns, but the critical modal bug needs to be fixed before merging. The missing tests and accessibility improvements should also be addressed.


@claude
Copy link

claude bot commented Nov 7, 2025

Claude finished @epeicher's task —— View job


Comprehensive Code Review - PR #2025

I've completed a thorough code review of the "Publish site" button implementation. Here are my findings:


🔴 Critical Issues

1. Modal Bug - Root Cause Identified ⚠️

Issue: The modal doesn't appear on first click after npm start (as reported by @sejas and @katinthehatsite)

Root Cause: The tab remounting logic in site-content-tabs.tsx:52-54 conflicts with the modal opening sequence in publish-site-button.tsx:16-19.

What's happening:

  1. User clicks "Publish site"
  2. handlePublishClick sets tab to 'sync' (line 17)
  3. Then dispatches modal open action (line 18)
  4. However, the tab change triggers the useEffect in site-content-tabs.tsx:33-56
  5. This increments keyCounter (line 53), forcing TabPanel to remount
  6. The remount happens BEFORE ContentTabSync can render with the modal state
  7. After remount, the modal state is lost

Why switching tabs "fixes" it: When you switch to any other tab manually, it triggers another render cycle, and the modal state (which is persisted in Redux) finally gets picked up by the now-mounted ContentTabSync component.

Recommended Fix:

// In publish-site-button.tsx:16-19
const handlePublishClick = () => {
    dispatch( connectedSitesActions.openModal( 'push' ) );
    // Delay tab change to ensure modal state is committed first
    setTimeout( () => setSelectedTab( 'sync' ), 0 );
};

Alternatively, modify the remounting logic in site-content-tabs.tsx to check for active modal state before remounting:

// In site-content-tabs.tsx - add check before remounting
const hasActiveModal = useRootSelector( connectedSitesSelectors.selectIsModalOpen );
if ( !hasActiveModal ) {
    setKeyCounter( ( k ) => k + 1 );
    setProgrammaticTab( selectedTab );
}

⚠️ Important Issues

2. Missing Test Coverage

The new PublishSiteButton component has no dedicated test file. The existing test updates only verify unrelated functionality. Missing test cases:

  • ✅ Button renders when no sites are connected
  • ✅ Button doesn't render when sites exist
  • ✅ Button is disabled during sync operations
  • ✅ Clicking button navigates to sync tab
  • ✅ Clicking button opens push modal
  • ✅ Tooltip appears correctly when disabled
  • ✅ Accessibility attributes are correct

Recommendation: Create src/components/tests/publish-site-button.test.tsx


3. Accessibility Concerns

Current implementation (publish-site-button.tsx:31-38):

  • aria-label is present (good!)
  • ⚠️ Tooltip only works on hover (screen readers need more)
  • ⚠️ Disabled state message could be clearer

Recommendations:

  • Add aria-describedby to link button with tooltip content for screen readers
  • Consider adding role="status" for sync state announcements
  • Test keyboard navigation order (button appears before Start/Stop button - is this intentional?)

4. Layout & Responsiveness Issues

Current placement (site-management-actions.tsx:40-41):

  • The button appears inline with Start/Stop button in a flex container
  • When PublishSiteButton appears/disappears, the Start/Stop button shifts position (inconsistent UX)
  • No responsive breakpoints defined (could overflow on small windows)

From PR comments: @sejas suggested placing the button on the left side to prevent the Start/Stop button from shifting. This is a better UX pattern.

Design uncertainty: Comments indicate ongoing discussion about moving to main navigation (Options E/F). Consider holding PR until design is finalized to avoid rework.


5. Performance Regression 📊

The performance test shows a 29.4% regression in site-editor load time (8140ms → 10536ms). While this PR only adds a button and doesn't touch site-editor code directly, this needs investigation:

Possible causes:

  • Additional Redux selector calls on every render
  • Unrelated to this PR (timing coincidence)
  • Test flakiness

Recommendation: Re-run performance tests to confirm if this is a real regression or a fluke.


✅ Code Quality Observations

Positive Points:

  • ✅ Clean early return pattern for conditional rendering (line 21)
  • ✅ Proper use of Tooltip component for disabled state feedback
  • ✅ Good separation of concerns with dedicated component
  • ✅ Consistent use of i18n for all user-facing strings
  • ✅ Proper Redux state management with hooks
  • ✅ TypeScript types are correctly used

Minor Issues:

  • The component has clean code structure
  • Good use of custom hooks (useContentTabs, useConnectedSitesData, useSyncSites)
  • Disabled logic is clear and well-reasoned

🔒 Security Review

✅ No security issues identified:

  • No user input handling (button only)
  • No XSS vulnerabilities
  • Proper use of React patterns prevents injection attacks
  • Redux actions are properly typed
  • IPC not directly accessed (goes through hooks)
  • No hardcoded secrets or sensitive data

🌍 Cross-Platform Compatibility

Generally good, but consider:

  1. RTL Language Support: The flex layout should handle RTL correctly, but verify with dir="rtl" testing
  2. macOS vs Windows:
    • Tooltip interactions should be tested on both platforms
    • Button rendering should be verified on both platforms
    • As per CLAUDE.md, this needs testing on macOS and Windows before merging
  3. Keyboard Navigation: Verify tab order works consistently across platforms

📝 Documentation & Code Comments

Missing:

  • No JSDoc comments for the component
  • No inline comments explaining business logic
  • CLAUDE.md doesn't need updating (no architectural changes)

Recommendation: Add a brief JSDoc comment explaining:

  • When the button appears (no connected sites)
  • What it does (navigates to sync tab and opens push modal)
  • Why it's disabled during sync operations

🎯 Testing Instructions Verification

I reviewed the testing instructions in the PR body:

✅ Clear steps provided
✅ Covers happy path (no connected sites → button appears → modal opens)
✅ Covers edge case (connected sites → button hidden)
⚠️ Missing: Test the known bug (modal not appearing on first click after npm start)
⚠️ Missing: Test disabled state (when another site is syncing)


📋 Recommendations Summary

Must Fix Before Merge:

  1. Fix the modal bug (critical UX issue)
  2. Add comprehensive tests for PublishSiteButton
  3. Investigate performance regression (re-run tests)

Should Fix Before Merge:

  1. Improve accessibility (ARIA attributes, screen reader support)
  2. Consider button placement (left side to prevent Start/Stop shift)
  3. Add JSDoc comments to the component

Consider:

  1. Wait for design finalization (ongoing discussion about moving to main navigation)
  2. Test cross-platform (macOS and Windows as per CLAUDE.md)
  3. Verify RTL language support

🎨 Design Feedback Context

From PR comments, there's active discussion about button placement:

  • Current implementation: Button in header actions (to the left of Start/Stop button)
  • Design discussion: Options E/F with button in main navigation instead
  • Latest feedback: @sejas prefers Option F with button on the left side to prevent Start/Stop button from shifting

Given this uncertainty, consider holding this PR until design is finalized to avoid rework.


Overall Assessment

Code Quality: ✅ Good - Clean implementation following project patterns
Functionality: ⚠️ Blocked by modal bug - Needs fix before merge
Testing: ❌ Insufficient - No dedicated tests
Security: ✅ No issues
Performance: ⚠️ Needs investigation (29.4% regression)
Accessibility: ⚠️ Needs improvement
Cross-Platform: ⚠️ Needs testing

Recommendation: Address the critical modal bug and add tests before merging. Consider waiting for design finalization to avoid potential rework.


@claude
Copy link

claude bot commented Nov 7, 2025

Claude Code is working…

I'll analyze this and get back to you.

View job run

@epeicher
Copy link
Contributor Author

epeicher commented Nov 7, 2025

Thanks @katinthehatsite, @sejas, and @wojtekn for your reviews and suggestions! I have implemented option F as suggested. Could you please give another review if possible? 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants